<template>
	<view>
		<view v-if="isExist">
			<text class="title">{{data.title}}</text>
			<text class="time">{{ $u.timeFormat(data.create_time, 'yyyy年mm月dd日') }}</text>
			<!--<swiper-base-image :list="imgList" />-->
			<u-parse :content="data.detail" class="content" :selectable="true"></u-parse>
			<view>
				<view v-for="item in data.profile" @click="download(item.url)">{{item.name}}</view>
			</view>
		</view>
		<view  v-if="!isExist" style="width: 100vw;margin-top: 20vh;">
			<u-empty
				mode="search"
				:icon="emptyIcon"
				text="文章已下架"
			></u-empty>
		</view>
	</view>
	
</template>

<script>
	import utils from '@/config/utils'
	import msgService from '@/service/msg/MsgService.js'
	export default {
		
		data() {
			return {
				emptyIcon:this.$server.imgBaseURL+'/static/wechat/images/search.png',
				content_id:null,
				data:{},
				imgList:[],
				isExist:true
			}
		},
		onLoad(e){
			if(e.content_id){
				this.content_id = e.content_id
			}else{
				this.isExist = false
			}
			
			this.getInfo()
		
		},
		methods: {
			async getInfo(){
				const res = await msgService.info({content_id:this.content_id})
				this.data = res.data 
				if(res.data.pic !=''){
					this.imgList.push(res.data.pic)
				}
			},
			// 附件下载
			download(url){
				utils.download(url)
			},
		},
	}
</script>

<style lang="less">
page {
	background-color: #f1f2f5;
	padding: 20rpx;
}
.title {
	color: #333;
	display: block;
	font-size: 40rpx;
	font-weight: bold;
	word-spacing: 8rpx;
	text-align: center;
	width: 100%;
}
.time {
	color: #878787;
	display: block;
	font-size: 22rpx;
	margin: 12rpx 0;
	text-align: right;
}
.content {
	display: block;
	color: #000;
	margin-top: 64rpx;
	font-size: 32rpx;
	line-height: 64rpx;
	text-indent: 64rpx;
	text-align:justify
}
.u-swiper__wrapper__item__wrapper{
	flex-direction: column!important;
}
</style>
